{extend name="index/iframe" /}

{block name="content"}
<form class="layui-form" action="" style="padding-top:10px; padding-right:10px;">
    <input type="hidden" name="game_id" id="game_id" value="{$Think.get.game_id}">
    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏名称</label>
                <div class="layui-input-block">
                    <input type="text" name="game_name" value="{$find.game_name}" lay-verify="required" placeholder="请输入游戏名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏版本</label>
                <div class="layui-input-block">
                    <select name="publish_attr" lay-filter="publish_attr" id="publish_attr" lay-verify="required">
                        <option value="">全部</option>
                        {foreach $Think.config.publish_attr as $k=>$v}
                        <option value="{$k}" {$find.publish_attr==$k ? 'selected' : ''}>{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏平台</label>
                <div class="layui-input-block">
                    <select name="plat_attr" lay-filter="plat_attr" id="plat_attr" lay-verify="required">
                        <option value="">全部</option>
                        {foreach $Think.config.plat_attr_text as $k=>$v}
                        <option value="{$k}" {$find.plat_attr==$k ? 'selected' : ''}>{$v}</option>
                        {/foreach}
                    </select>
                    <input type="hidden" value="{$find.platform}" id="platform" name="platform">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">充值比例</label>
                <div class="layui-input-block">
                    <input type="text" name="charge_rate" lay-verify="required" value="{$find.charge_rate}" placeholder="请输入充值比例" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏类型</label>
                <div class="layui-input-block">
                    <select name="game_attr" lay-filter="game_attr" id="game_attr" lay-verify="required">
                        <option value="">全部</option>
                        {foreach $Think.config.game_attr as $k=>$v}
                        <option value="{$k}" {$find.game_attr==$k ? 'selected' : ''} >{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏标签</label>
                <div class="layui-input-block">
                    <input type="text" value="{$my_tag}" id="game_tags" lay-verify="required" placeholder="游戏标签" autocomplete="off" class="layui-input">
                    <input type="hidden" name="tags" value="{$find.tags}" id="tags">
                    <div id="game_tags_box" switch="off">
                        {volist name="game_tag" id="vo"}<button class='layui-btn layui-btn-sm game_tags_btn {in name="$vo.id" value="$find.tags"}my-btn{/in}' value="{$vo.id}" switch='{in name="$vo.id" value="$find.tags"}on{else/}off{/in}'>{$vo.name}</button>{/volist}
                    </div>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">H5游戏地址</label>
                <div class="layui-input-block">
                    <input type="text" name="h5_game_url" value="{$find.h5_game_url}" id="h5_game_url" disabled="" placeholder="请输入H5游戏地址" autocomplete="off" class="layui-input layui-disabled">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">所属CP</label>
                <div class="layui-input-block">
                    <select name="cp_id" lay-filter="cp_id" id="cp_id">
                        <option value="">请选择CP</option>
                        {volist name="cp_account" id="vo"}
                        <option value="{$vo.id}" {$find.cp_id==$vo.id ? 'selected' : ''}>{$vo.username}</option>
                        {/volist}
                    </select>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">上传位置</label>
                <div class="layui-input-block">
                    <select name="up_location" lay-filter="up_location" id="up_location" lay-verify="required">
                        <option value="">全部</option>
                        <option value="0" {if condition="$find.up_location eq 0"}selected{/if}>CDN</option>
                        <option value="1" {if condition="$find.up_location eq 1"}selected{/if}>金山云</option>
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">sdk版本</label>
                <div class="layui-input-block">
                    <select name="sdk_version" lay-filter="sdk_version" id="sdk_version" lay-verify="required">
                        <option value="">全部</option>
                        <option value="v1.0" {if condition="$find.sdk_version eq 'v1.0'"}selected{/if}>v1.0</option>
                        <option value="v2.0" {if condition="$find.sdk_version eq 'v2.0'"}selected{/if}>v2.0</option>
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">苹果内购</label>
                <div class="layui-input-block">
                    <select name="apple_recharge" lay-filter="apple_recharge" id="apple_recharge" class="layui-disabled" disabled="">
                        <option value="">全部</option>
                        <option value="0" {if condition="$find.apple_recharge eq 0"}selected{/if}>关闭</option>
                        <option value="1" {if condition="$find.apple_recharge eq 1"}selected{/if}>开启</option>
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏语言</label>
                <div class="layui-input-block">
                    <input type="text" name="language" value="{$find.language}" id="language" placeholder="请输入游戏语言"  lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">游戏评分</label>
                <div class="layui-input-block">
                    <input type="text" name="score" value="{$find.score}" placeholder="请输入游戏评分（如 8.2）" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">下载次数</label>
                <div class="layui-input-block">
                    <input type="text" name="download_base" value="{$find.download_base}" placeholder="请输入游戏安装次数（如 12574）" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">开发公司</label>
                <div class="layui-input-block">
                    <input type="text" name="develop" value="{$find.develop}" placeholder="请输入游戏开发公司" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs4">
                <label class="layui-form-label">支付回调</label>
                <div class="layui-input-block">
                    <input type="text" name="pay_callback" value="{$find.pay_callback}" id="pay_callback" placeholder="请输入支付回调地址" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">返利回调</label>
                <div class="layui-input-block">
                    <input type="text" name="rebate_callback" value="{$find.rebate_callback}" id="rebate_callback" placeholder="请输入返利回调地址" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">GM回调</label>
                <div class="layui-input-block">
                    <input type="text" name="gm_callback" value="{$find.gm_callback}" id="gm_callback" placeholder="请输入GM回调地址" autocomplete="off" class="layui-input layui-disabled"  disabled="">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs4">
                <label class="layui-form-label">上线日期</label>
                <div class="layui-input-block">
                    <input type="text" name="online_time_region" value="{$find.online_time_region}" class="layui-input" lay-verify="datetime" id="online_time_region" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">预发布</label>
                <div class="layui-input-block">
                    <input type="text" name="plat_show_region" value="{$find.plat_show_region}" class="layui-input datetime-item" lay-verify="datetime" id="plat_show_region" placeholder="yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss"  lay-verify="datetime" autocomplete="off">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">充值开放</label>
                <div class="layui-input-block">
                    <input type="text" name="charge_time_region" value="{$find.charge_time_region}" class="layui-input datetime-item" lay-verify="datetime" id="charge_time_region" placeholder="yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss"  lay-verify="datetime" autocomplete="off">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs4">
                <label class="layui-form-label">注册开放</label>
                <div class="layui-input-block">
                    <input type="text" name="reg_time_region" value="{$find.reg_time_region}" class="layui-input datetime-item" lay-verify="datetime" id="reg_time_region" placeholder="yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss"  lay-verify="datetime" autocomplete="off">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">登录开放</label>
                <div class="layui-input-block">
                    <input type="text" name="login_time_region" value="{$find.login_time_region}" class="layui-input datetime-item" lay-verify="datetime" id="login_time_region" placeholder="yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss"  lay-verify="datetime" autocomplete="off">
                </div>
            </div>
            <div class="layui-col-xs4">
                <label class="layui-form-label">打包开放</label>
                <div class="layui-input-block">
                    <input type="text" name="pack_time_region" value="{$find.pack_time_region}" class="layui-input datetime-item" lay-verify="datetime" id="pack_time_region" placeholder="yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss"  lay-verify="datetime" autocomplete="off">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-row">
            <div class="layui-col-xs6 layui-col-md6">
                <label class="layui-form-label">图片集</label>
                <div class="layui-input-block">
                    <table class="layui-table" lay-size="sm" style="margin-top:0px;">
                        <thead>
                        <tr style="height: 38px;">
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="demoList">
                        {foreach $my_images as $k=>$v}
                        <tr>
                            <td>{$v}</td>
                            <td></td>
                            <td style="color: #5FB878;">上传成功</td>
                            <td><a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger images-delete">删除</a></td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                    <div style="text-align: center;">
                        <button type="button" class="layui-btn layui-btn-primary" id="testList">选择多文件</button>
                        <button type="button" class="layui-btn layui-btn-disabled" id="testListAction">开始上传</button>
                    </div>
                </div>
                <input type="hidden" name="images" value="{$find.images}" id="images">
            </div>
            <div class="layui-col-xs6 layui-col-md6">
                <label class="layui-form-label">游戏图标组</label>
                <div class="layui-input-block game_icon_box game_icon_box1">
                    <input type="text" value="{$find.icon}" name="icon" placeholder="小尺寸图标（85px * 85px）" autocomplete="off" class="layui-input">
                    <a href="javascript:;" class="layui-btn-sm layui-btn game_icon_upload icon1">上传</a>
                    <a href="javascript:;" class="layui-btn-sm layui-btn layui-btn-danger game_icon_del">删除</a>
                </div>
                <div class="layui-input-block game_icon_box game_icon_box2">
                    <input type="text" value="{$find.icon_md}" name="icon_md" placeholder="中尺寸图标（220px * 220px）" autocomplete="off" class="layui-input">
                    <a href="javascript:;" class="layui-btn-sm layui-btn game_icon_upload icon2">上传</a>
                    <a href="javascript:;" class="layui-btn-sm layui-btn layui-btn-danger game_icon_del">删除</a>
                </div>
                <div class="layui-input-block game_icon_box game_icon_box3">
                    <input type="text" value="{$find.icon_lg}" name="icon_lg" placeholder="大尺寸图标（512px * 512px）" autocomplete="off" class="layui-input">
                    <a href="javascript:;" class="layui-btn-sm layui-btn game_icon_upload icon3">上传</a>
                    <a href="javascript:;" class="layui-btn-sm layui-btn layui-btn-danger game_icon_del">删除</a>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">游戏简介</label>
        <div class="layui-input-block">
            <textarea id="summary" rows="6" name="summary" class="layui-textarea" placeholder="请输入游戏简介">{$find.summary}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">游戏内容</label>
        <div class="layui-input-block">
            <textarea id="content" rows="10" name="content" class="layui-textarea" placeholder="请输入游戏内容">{$find.content}</textarea>
        </div>
    </div>

    <div class="layui-form-item" style="margin-bottom: 100px;">
        <div class="layui-input-block">
            <button class="layui-btn my-btn" lay-submit="" lay-filter="submitBtn">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}

{block name="css"}
<style>
    #game_tags_box {display: none; width: 427px; height: 170px; background: #fff; border: 1px solid #D2D2D2; z-index: 999; position: absolute; left: 0; top: 42px; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.12); box-sizing: border-box; padding: 5px; margin-right: -5px;}
    .game_tags_btn {background: #ccc;margin: 3px 5px 3px 0px;}
    .game_icon_box {margin-bottom: 5px; position: relative;}
    .game_icon_upload {background: rgb(95, 184, 120); position: absolute; right:53px; top: 6px;}
    .game_icon_del {position: absolute; right:5px; top: 6px;}
</style>
{/block}

{block name="js"}
<script>
    layui.use(['form', 'laydate', 'element', 'upload'], function(){
        var form = layui.form
            ,$ = layui.$
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,upload = layui.upload;

        //点击游戏标签，出现标签选择
        $('#game_tags').click(function(){
            if( $("#game_tags_box").attr("switch") == "off" ){
                $("#game_tags_box").fadeIn(200);
                $("#game_tags_box").attr("switch","on");
            }else{
                $("#game_tags_box").fadeOut(200);
                $("#game_tags_box").attr("switch","off");
            }
        })

        //点击标签，加入样式
        $('.game_tags_btn').click(function(){
            if( $(this).attr('switch') == 'off' ){
                var val = $('#game_tags').val();
                val = val=='' ? $(this).text() : val + ',' + $(this).text();
                $('#game_tags').val(val);

                var val2 = $('#tags').val();
                val2 = val2=='' ? $(this).attr('value') : val2 + ',' + $(this).attr('value');
                $('#tags').val(val2);

                $(this).addClass('my-btn');
                $(this).attr('switch', 'on');
            }else{
                var val = ',' + $('#game_tags').val();
                val = val.replace(',' + $(this).text(), "");
                $('#game_tags').val(val.substr(1,val.length));

                var val2 = ',' + $('#tags').val();
                val2 = val2.replace(',' + $(this).attr('value'), "");
                $('#tags').val(val2.substr(1,val2.length));

                $(this).removeClass('my-btn');
                $(this).attr('switch', 'off');
            }
            return false;
        });

        //点击文档，隐藏标签
        $(document).bind("click",function(e){
            var target  = $(e.target);
            if(target.closest("#game_tags_box,#game_tags").length == 0){
                $("#game_tags_box").fadeOut(200);
                $("#game_tags_box").attr("switch","off");
            };
            e.stopPropagation();
        });

        //上线日期为单个
        laydate.render({
            elem: '#online_time_region',
            type: 'datetime'
        });

        //同时绑定多个日期
        lay('.datetime-item').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true
                ,calendar: true
                ,min: '2016-01-01'
            });
        });

        //默认执行一次
        if({$find.publish_attr}==2){ //如果是GM，显示GM回调
            $('#gm_callback').removeClass('layui-disabled').attr('disabled', false);
        }

        //禁用启用input
        form.on('select(publish_attr)', function(data){
            if(data.value==2){ //如果是GM，显示GM回调
                $('#gm_callback').removeClass('layui-disabled').attr('disabled', false);
            }else{
                $('#gm_callback').addClass('layui-disabled').attr('disabled', true);
            }
        });

        //默认执行一次
        if({$find.plat_attr}==1 || {$find.plat_attr}==2){ //如果IOS平台，显示苹果内购
            $('#apple_recharge').removeClass('layui-disabled').attr('disabled', false);
        }
        if({$find.plat_attr}==4 || {$find.plat_attr}==5 || {$find.plat_attr}==6 || {$find.plat_attr}==7){ //如果H5，显示H5游戏地址，sdk版本为v2.0
            $('#h5_game_url').removeClass('layui-disabled').attr('disabled', false);
        }
        if({$find.plat_attr}==4){
            $("#sdk_version").val("v2.0");
        }
        form.render('select');
//        switch ($platAttr){//1:IOS,2:H5,3:ANDROID
//            case 1 : $platform = 1; break;
//            case 2 : $platform = 1; break;
//            case 3 : $platform = 3; break;
//            case 4 : $platform = 2; break;
//            case 5 : $platform = 3; break;
//            case 6 : $platform = 1; break;
//            case 7 : $platform = 1; break;
//            default: $platform = 3;
//        }

        form.on('select(plat_attr)', function(data){
            if(data.value==1 || data.value==2){ //如果IOS平台，显示苹果内购
                $('#platform').val(1);
                $('#apple_recharge').removeClass('layui-disabled').attr('disabled', false);
            }else{
                $('#apple_recharge').addClass('layui-disabled').attr('disabled', true);
            }

            if(data.value==3){
                $('#platform').val(3);
            }
            if(data.value==4){
                $('#platform').val(2);
            }
            if(data.value==5){
                $('#platform').val(3);
            }
            if(data.value==6){
                $('#platform').val(1);
            }
            if(data.value==7){
                $('#platform').val(1);
            }

            if(data.value==4 || data.value==5 || data.value==6 || data.value==7){ //如果H5，显示H5游戏地址，sdk版本为v2.0

                $('#h5_game_url').removeClass('layui-disabled').attr('disabled', false);
            }else{
                $('#h5_game_url').addClass('layui-disabled').attr('disabled', true);
            }

            if(data.value==4){
                $("#sdk_version").val("v2.0");
            }else{
                $("#sdk_version").val("v1.0");
            }

            form.render('select');
        });

        //多文件上传
        var imagesStr = '';
        var demoListView = $('#demoList')
            ,uploadListIns = upload.render({
            elem: '#testList'
            ,url: '{:url("Base/upload")}'+'?name=game_images&game_id='+$('#game_id').val()
            ,accept: 'images'
            ,multiple: true
            ,auto: false
            ,bindAction: '#testListAction'
            ,choose: function(obj){
                var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                //读取本地文件
                obj.preview(function(index, file, result){
                    var tr = $(['<tr id="upload-'+ index +'">'
                        ,'<td>'+ file.name +'</td>'
                        ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
                        ,'<td>等待上传</td>'
                        ,'<td>'
                        ,'<a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger demo-delete">删除</a>'
                        ,'</td>'
                        ,'</tr>'].join(''));

                    //单个重传
                    tr.find('.demo-reload').on('click', function(){
                        obj.upload(index, file);
                    });

                    //删除
                    tr.find('.demo-delete').on('click', function(){
                        layer.confirm('确定要删除吗？', {offset: '250px'}, function(confirmIndex){
                            layer.close(confirmIndex);
                            delete files[index]; //删除对应的文件
                            tr.remove();
                            uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选

                            var val = ',' + $('#images').val();
                            console.dir(val+'ddddddd');
                            val = val.replace(',' + tr.find('td').eq(0).html(), "");
                            console.dir(val+'ccccccc');
                            $('#images').val(val.substr(1,val.length));
                            console.dir(val.substr(1,val.length));

                            if($("#demoList").html() == ""){
                                $('#testListAction').addClass('layui-btn-disabled').css({'background-color': '#FBFBFB'});
                            }
                        });
                    });

                    demoListView.append(tr);

                    $('#testListAction').removeClass('layui-btn-disabled').css({'background-color': '#5FB878'});

                    uploadListIns.config.data.name = 'game_images';
                    uploadListIns.config.data.game_id = $('#game_id').val();
                });
            }
            ,done: function(res, index, upload){
                if(res.code == 0){ //上传成功
                    var tr = demoListView.find('tr#upload-'+ index)
                        ,tds = tr.children();
                    tds.eq(0).html(res.data.src);
                    tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');

                    var val = $('#images').val()+','+res.data.src;
                    if(val.substr(0, 1) == ','){
                        val = val.substr(1,val.length)
                    }
                    $('#images').val(val);

                    return delete this.files[index]; //删除文件队列已经上传成功的文件
                }
                this.error(index, upload);
            }
            ,error: function(index, upload){
                var tr = demoListView.find('tr#upload-'+ index)
                    ,tds = tr.children();
                tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
                tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
            }
        });

        //ICON上传
        var uploadInst2 = upload.render({
            elem: '.icon1'
            ,url: '{:url("Base/upload")}'+'?name=game_icon&game_id='+$('#game_id').val()
            ,before: function(obj){}
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }else{
                    $('input[name="icon"]').val(res.data.src);
                }
            }
            ,error: function(){}
        });
        var uploadInst3 = upload.render({
            elem: '.icon2'
            ,url: '{:url("Base/upload")}'+'?name=game_icon&game_id='+$('#game_id').val()
            ,before: function(obj){}
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }else{
                    $('input[name="icon_md"]').val(res.data.src);
                }
            }
            ,error: function(){}
        });
        var uploadInst4 = upload.render({
            elem: '.icon3'
            ,url: '{:url("Base/upload")}'+'?name=game_icon&game_id='+$('#game_id').val()
            ,before: function(obj){}
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }else{
                    $('input[name="icon_lg"]').val(res.data.src);
                }
            }
            ,error: function(){}
        });

        $('.game_icon_del').click(function(){
            $(this).siblings('input').val('');
        })

        $("body").on('click', '.images-delete', function(){
            var thisObj = $(this);
            layer.confirm('确定要删除吗？', {offset: '250px'}, function(index){
                var val = ',' + $('#images').val()
                    ,htm = thisObj.parents('tr').find('td').eq(0).html();
                val = val.replace(',' + htm, "");
                $('#images').val(val.substr(1,val.length));
                thisObj.parents('tr').remove();
                layer.close(index);
            });

        })


        //提交
        form.on('submit(submitBtn)', function(data){
            var load = layer.load();
            $.post('{:url("GameList/edit")}',data.field, function(json){
                layer.close(load);
                json.code==0 ? layer.msg(json.msg, {icon: 1, time: 1000}) : layer.msg(json.msg, {icon: 0, time: 1000});
            }, 'JSON').error(function(){
                layer.close(load);
                layer.msg('连接超时，请联系后台管理员', {icon: 2, time:3000});
            });
            return false;
        });
    });
</script>
{/block}